package com.qf.demo;

import com.qf.pojo.Account;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ClassPathBeanDefinitionScanner;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

/**
 * @ClassName Demo01
 * @Description TODO
 * @Author 86181
 * @Date 2022/9/1 15:05
 * @Version 1.0
 **/
public class Demo01 {
    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("bean.xml");
        JdbcTemplate jdbcTemplate = applicationContext.getBean("jdbcTemplate", JdbcTemplate.class);
        List<Account> list = jdbcTemplate.query("select * from account ", new BeanPropertyRowMapper<>(Account.class));
        for (Account account : list) {
            System.out.println(account);
        }

    }
}
